#ifndef __COMMAND_STACK__
#define __COMMAND_STACK__

#include "../include/head.h"

typedef struct stackNode_s{
    char *data;
    struct stackNode_s *next;
}stackNode_t;

typedef struct commandStack_s{
    stackNode_t *pTop;  // 栈顶，进行入栈压栈
    stackNode_t *pBottom;  // 栈底
    int stackSize;
}commandStack_t;

int init_command_stack(commandStack_t *pcommandStack);
int push_command_stack(commandStack_t *pcommandStack, const char *value, const int length);
int pop_command_stack(commandStack_t *pcommandStack);
int assemble_stack(const commandStack_t *stack,char buf[]);
int print_stack(const commandStack_t *stack);
int clear_stack(commandStack_t *stack);
int get_homedir(char buf[]);
int do_ls(int netfd,commandStack_t * stack, commandStack_t *stack2);
int do_pwd(int netfd,commandStack_t *stack);
int do_mkdir(int netfd,commandStack_t *stack);
int do_rmdir(int netfd,commandStack_t *stack);
int do_cd(int netfd,commandStack_t *stack,commandStack_t *cdstack);
int do_puts(int netfd,commandStack_t *stack);
int do_gets(int netfd,commandStack_t *stack);

int s_download(int netfd,commandStack_t *pcommandStack);
int s_recv_up(int netfd,commandStack_t *pcommandStack);

#endif
